<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <body>
        <ui:composition template="../templates/default3.xhtml">  
            <ui:define name="left">
            </ui:define>
            <ui:define name="content">
                <h:form id="assignRoles" binding="#{assignRoleManagerBean.loadAssignRole}">
                    <p:messages id ="error" />
                    <p:panel header="Select employee" id="selectEmployee">
                        <table>
                            <tr>                             
                                <td> 
                                    User ID:
                                </td>
                                <td> 
                                    <b><h:outputText id="userId" value="#{assignRoleManagerBean.userId}"/> </b> 
                                </td> 
                                <tr>
                                    <td>Name:</td>
                                    <td><h:outputText id="name" value="#{assignRoleManagerBean.name}"/></td>
                                </tr>
                                <tr>
                                    <td>Department:</td>
                                    <td>
                                        <h:outputText id="department" value="#{assignRoleManagerBean.department}"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Designation:</td>
                                    <td>
                                        <h:outputText id="designation" value="#{assignRoleManagerBean.designation}"/>
                                    </td>
                                </tr>
                            </tr>
                        </table>
                    </p:panel>
                    <p:panel header="Manage role" id="rolesPanel">
                        <table class="panel" border="0">
                            <tr>
                                <td align="center">
                                    <table>
                                        <tr>
                                            <td>
                                                Available roles
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                                Current roles
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h:selectOneListbox value="#{assignRoleManagerBean.selectAdd}" size="15" style="width:250px">
                                                    <f:selectItems value="#{assignRoleManagerBean.rolesAvailable}"/>    
                                                </h:selectOneListbox>
                                                <f:selectItem itemLabel="Select One" itemValue=""/>  
                                            </td>
                                            <td valign ="top">
                                                <p:commandButton id="btnAddRole" styleClass="btnAssign" value="Add" actionListener="#{assignRoleManagerBean.addRole}" ajax="true" update="assignRoles"/>
                                                <br/><br/>
                                                <p:commandButton id="btnRemoveRole"  styleClass="btnAssign" value="Remove" actionListener="#{assignRoleManagerBean.removeRole}"  ajax="true" update="assignRoles"/>
                                            </td>
                                            <td>
                                                <h:selectOneListbox value="#{assignRoleManagerBean.selectRemove}" size="15" style="width:250px">
                                                    <f:selectItems value="#{assignRoleManagerBean.rolesCurrent}"/>    </h:selectOneListbox>
                                                <f:selectItem itemLabel="Select One" itemValue=""/>  
                                            </td>
                                        </tr>

                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3" class="btn"><hr/>
                                    <p:commandButton id="btnDone" value="Done" actionListener="#{assignRoleManagerBean.doneUpdate}" ajax="true" update="error"/>
                                </td>
                            </tr>
                        </table>
                        <br/>
                        <br/>
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>